FROM tomcat:8.5.51

# 时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR /usr/local/tomcat

ADD memory.sh ./memory.sh
RUN wget https://goodrain-delivery.oss-cn-hangzhou.aliyuncs.com/zhangz/tomcat-linux.tar.gz \
&& tar xvf tomcat-linux.tar.gz \
&& mv tomcat-linux/webapps/* ./webapps \
&& cp /usr/local/tomcat/tomcat-linux/lib/tools.jar  /usr/local/tomcat/webapps/webroot/WEB-INF/lib/ \
&& rm -rf tomcat-linux.tar.gz  

#添加内存设置脚本
ADD memory.sh /memory.sh

ADD docker-entrypoint.sh /docker-entrypoint.sh
#加载脚本
RUN sed -i "2a . /memory.sh" /usr/local/tomcat/bin/catalina.sh \
&& chmod +x /docker-entrypoint.sh /memory.sh 

EXPOSE 8080

#启动命令
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["catalina.sh","run"]


